#include "TimeCostRecord.h"
#include <iostream>

using namespace std;

TimeCostRecord::TimeCostRecord( const string& name )
{
    this->name = name;
    LARGE_INTEGER largeIntBeginTime;
    QueryPerformanceCounter(&largeIntBeginTime);
    beginTime =  largeIntBeginTime.QuadPart;
}

TimeCostRecord::~TimeCostRecord()
{
    LARGE_INTEGER nFreq;
    QueryPerformanceFrequency(&nFreq);
    LONGLONG freq = nFreq.QuadPart;

    LARGE_INTEGER largeIntEndTime;
    QueryPerformanceCounter(&largeIntEndTime);
    LONGLONG endTime =  largeIntEndTime.QuadPart;

    cout << name << " use ms " << 1000 * ((endTime - beginTime) / (double)freq) << endl;
}
